// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.randomizedWorld.randomizedVehicleStory;

import zombie.core.Rand;
import zombie.iso.IsoChunk;
import zombie.iso.IsoDirections;
import zombie.iso.IsoGridSquare;
import zombie.iso.IsoMetaGrid;
import zombie.iso.Vector2;
import zombie.vehicles.BaseVehicle;

public final class RVSBurntCar extends RandomizedVehicleStoryBase {
    public RVSBurntCar() {
        this.name = "Burnt Car";
        this.minZoneWidth = 2;
        this.minZoneHeight = 5;
        this.setChance(13);
    }

    @Override
    public void randomizeVehicleStory(IsoMetaGrid.Zone zone, IsoChunk chunk) {
        this.callVehicleStorySpawner(zone, chunk, 0.0F);
    }

    @Override
    public boolean initVehicleStorySpawner(IsoMetaGrid.Zone zone, IsoChunk chunk, boolean debug) {
        VehicleStorySpawner vehicleStorySpawner = VehicleStorySpawner.getInstance();
        vehicleStorySpawner.clear();
        Vector2 vector2 = IsoDirections.N.ToVector();
        float _float = (float) (Math.PI / 6);
        if (debug) {
            _float = 0.0F;
        }

        vector2.rotate(Rand.Next(-_float, _float));
        vehicleStorySpawner.addElement("vehicle1", 0.0F, 0.0F, vector2.getDirection(), 2.0F, 5.0F);
        vehicleStorySpawner.setParameter("zone", zone);
        return true;
    }

    @Override
    public void spawnElement(VehicleStorySpawner spawner, VehicleStorySpawner.Element element) {
        IsoGridSquare isoGridSquare = element.square;
        if (isoGridSquare != null) {
            float _float = element.z;
            IsoMetaGrid.Zone zone = spawner.getParameter("zone", IsoMetaGrid.Zone.class);
            String string = element.id;
            byte _byte = -1;
            switch (string.hashCode()) {
                case 2014205573:
                    if (string.equals("vehicle1")) {
                        _byte = 0;
                    }
                default:
                    switch (_byte) {
                        case 0:
                            BaseVehicle baseVehicle = this.addVehicle(
                                zone, element.position.x, element.position.y, _float, element.direction, null, "Base.CarNormal", null, null
                            );
                            if (baseVehicle != null) {
                                baseVehicle = baseVehicle.setSmashed("right");
                            }
                    }
            }
        }
    }
}
